﻿using MyFloridaHouse.libSvCommonUtilities;
using MyFloridaHouse.libSvOpenDistricts.StorageIsolated;
using MyFloridaHouse.libSvUtilities;
using System.Collections.Generic;

namespace MyFloridaHouse.libSvOpenDistricts.Districts
{
    public class DistrictClipboard
    {

        public bool SaveDistrictsToClipboard(List<UOG> uogIDList)
        {
            byte[] serializedShapeUogIDList = SerializationManager.Serialize(uogIDList);
            byte[] serializedAndCompressedShapeUogIDList = CompressionManager.Compress(serializedShapeUogIDList);
            return IsolatedStorageManager.SaveData(serializedAndCompressedShapeUogIDList, Constants.DistrictCopyClipboardDirectoryName, Constants.DistrictCopyClipboardFileName);
        }


        public List<UOG> LoadDistrictsFromClipboard()
        {
            byte[] serializedAndCompressedShapeUogIDList = IsolatedStorageManager.LoadBinaryData(Constants.DistrictCopyClipboardDirectoryName, Constants.DistrictCopyClipboardFileName);
            byte[] serializedShapeUogIDList = CompressionManager.DecompressToByteArray(serializedAndCompressedShapeUogIDList);
            List<UOG> uogIDList = (List<UOG>)SerializationManager.Deserialize(typeof(List<UOG>), serializedShapeUogIDList);
            return uogIDList;
        }


    }
}
